// 统一API入口

// 销售数据API
export const getSalesData = async () => {
  await new Promise(resolve => setTimeout(resolve, 500));
  return {
    currentMonth: '2025年12月',
    salesData: [
      {
        name: '张三',
        phone: '152xxxx2222',
        totalSales: 206
      },
      {
        name: '李四',
        phone: '138xxxx3333', 
        totalSales: 350
      },
      {
        name: '王五',
        phone: '186xxxx4444',
        totalSales: 120
      }
    ]
  };
};

// 首页数据API
export const getHomeData = async () => {
  await new Promise(resolve => setTimeout(resolve, 300));
  return {
    totalSales: 12000,
    newCustomers: 15,
    activeUsers: 86
  };
};

// 通用错误处理
const handleError = (error) => {
  console.error('API Error:', error);
  throw error;
};

export default {
  getSalesData,
  getHomeData,
  handleError
};
